﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using HYSoft.IDAL;
using HYSoft.DBUtility;//Please add references

namespace HYSoft.SQLServerDAL
{
    /// <summary>
    /// 数据访问类:usr2node
    /// </summary>
    public partial class usr2node : Iusr2node
    {
        public usr2node()
        { }
        #region  BasicMethod

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int index, int mac, string simno, string addr, string msgno, int areano, int adminno, int intvalue1, int intvalue2, int intvalue3, string charvalue1, string charvalue2, string charvalue3, string wendu, string dianchi, string gongdian, string dianliang, string chuanganqi, string jingbao, string tux, int value0, int rate0, int value1, int rate1, int value2, int rate2, int value3, int rate3, int value4, int rate4, int value5, int rate5, int user_index, string name, string mobile)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from usr2node");
            strSql.Append(" where [index]=@index and mac=@mac and simno=@simno and addr=@addr and msgno=@msgno and areano=@areano and adminno=@adminno and intvalue1=@intvalue1 and intvalue2=@intvalue2 and intvalue3=@intvalue3 and charvalue1=@charvalue1 and charvalue2=@charvalue2 and charvalue3=@charvalue3 and wendu=@wendu and dianchi=@dianchi and gongdian=@gongdian and dianliang=@dianliang and chuanganqi=@chuanganqi and jingbao=@jingbao and tux=@tux and value0=@value0 and rate0=@rate0 and value1=@value1 and rate1=@rate1 and value2=@value2 and rate2=@rate2 and value3=@value3 and rate3=@rate3 and value4=@value4 and rate4=@rate4 and value5=@value5 and rate5=@rate5 and user_index=@user_index and name=@name and mobile=@mobile ");
            SqlParameter[] parameters = {
					new SqlParameter("@index", SqlDbType.Int,4),
					new SqlParameter("@mac", SqlDbType.Int,4),
					new SqlParameter("@simno", SqlDbType.VarChar,50),
					new SqlParameter("@addr", SqlDbType.VarChar,250),
					new SqlParameter("@msgno", SqlDbType.VarChar,50),
					new SqlParameter("@areano", SqlDbType.Int,4),
					new SqlParameter("@adminno", SqlDbType.Int,4),
					new SqlParameter("@intvalue1", SqlDbType.Int,4),
					new SqlParameter("@intvalue2", SqlDbType.Int,4),
					new SqlParameter("@intvalue3", SqlDbType.Int,4),
					new SqlParameter("@charvalue1", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue2", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue3", SqlDbType.VarChar,250),
					new SqlParameter("@wendu", SqlDbType.VarChar,250),
					new SqlParameter("@dianchi", SqlDbType.VarChar,250),
					new SqlParameter("@gongdian", SqlDbType.VarChar,250),
					new SqlParameter("@dianliang", SqlDbType.VarChar,250),
					new SqlParameter("@chuanganqi", SqlDbType.VarChar,250),
					new SqlParameter("@jingbao", SqlDbType.VarChar,250),
					new SqlParameter("@tux", SqlDbType.VarChar,250),
					new SqlParameter("@value0", SqlDbType.Int,4),
					new SqlParameter("@rate0", SqlDbType.Int,4),
					new SqlParameter("@value1", SqlDbType.Int,4),
					new SqlParameter("@rate1", SqlDbType.Int,4),
					new SqlParameter("@value2", SqlDbType.Int,4),
					new SqlParameter("@rate2", SqlDbType.Int,4),
					new SqlParameter("@value3", SqlDbType.Int,4),
					new SqlParameter("@rate3", SqlDbType.Int,4),
					new SqlParameter("@value4", SqlDbType.Int,4),
					new SqlParameter("@rate4", SqlDbType.Int,4),
					new SqlParameter("@value5", SqlDbType.Int,4),
					new SqlParameter("@rate5", SqlDbType.Int,4),
					new SqlParameter("@user_index", SqlDbType.Int,4),
					new SqlParameter("@name", SqlDbType.VarChar,50),
					new SqlParameter("@mobile", SqlDbType.VarChar,50)			};
            parameters[0].Value = index;
            parameters[1].Value = mac;
            parameters[2].Value = simno;
            parameters[3].Value = addr;
            parameters[4].Value = msgno;
            parameters[5].Value = areano;
            parameters[6].Value = adminno;
            parameters[7].Value = intvalue1;
            parameters[8].Value = intvalue2;
            parameters[9].Value = intvalue3;
            parameters[10].Value = charvalue1;
            parameters[11].Value = charvalue2;
            parameters[12].Value = charvalue3;
            parameters[13].Value = wendu;
            parameters[14].Value = dianchi;
            parameters[15].Value = gongdian;
            parameters[16].Value = dianliang;
            parameters[17].Value = chuanganqi;
            parameters[18].Value = jingbao;
            parameters[19].Value = tux;
            parameters[20].Value = value0;
            parameters[21].Value = rate0;
            parameters[22].Value = value1;
            parameters[23].Value = rate1;
            parameters[24].Value = value2;
            parameters[25].Value = rate2;
            parameters[26].Value = value3;
            parameters[27].Value = rate3;
            parameters[28].Value = value4;
            parameters[29].Value = rate4;
            parameters[30].Value = value5;
            parameters[31].Value = rate5;
            parameters[32].Value = user_index;
            parameters[33].Value = name;
            parameters[34].Value = mobile;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(HYSoft.Model.usr2node model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into usr2node(");
            strSql.Append("[index],mac,simno,addr,msgno,areano,adminno,intvalue1,intvalue2,intvalue3,charvalue1,charvalue2,charvalue3,wendu,dianchi,gongdian,dianliang,chuanganqi,jingbao,tux,value0,rate0,value1,rate1,value2,rate2,value3,rate3,value4,rate4,value5,rate5,user_index,name,mobile)");
            strSql.Append(" values (");
            strSql.Append("@index,@mac,@simno,@addr,@msgno,@areano,@adminno,@intvalue1,@intvalue2,@intvalue3,@charvalue1,@charvalue2,@charvalue3,@wendu,@dianchi,@gongdian,@dianliang,@chuanganqi,@jingbao,@tux,@value0,@rate0,@value1,@rate1,@value2,@rate2,@value3,@rate3,@value4,@rate4,@value5,@rate5,@user_index,@name,@mobile)");
            SqlParameter[] parameters = {
					new SqlParameter("@index", SqlDbType.Int,4),
					new SqlParameter("@mac", SqlDbType.Int,4),
					new SqlParameter("@simno", SqlDbType.VarChar,50),
					new SqlParameter("@addr", SqlDbType.VarChar,250),
					new SqlParameter("@msgno", SqlDbType.VarChar,50),
					new SqlParameter("@areano", SqlDbType.Int,4),
					new SqlParameter("@adminno", SqlDbType.Int,4),
					new SqlParameter("@intvalue1", SqlDbType.Int,4),
					new SqlParameter("@intvalue2", SqlDbType.Int,4),
					new SqlParameter("@intvalue3", SqlDbType.Int,4),
					new SqlParameter("@charvalue1", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue2", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue3", SqlDbType.VarChar,250),
					new SqlParameter("@wendu", SqlDbType.VarChar,250),
					new SqlParameter("@dianchi", SqlDbType.VarChar,250),
					new SqlParameter("@gongdian", SqlDbType.VarChar,250),
					new SqlParameter("@dianliang", SqlDbType.VarChar,250),
					new SqlParameter("@chuanganqi", SqlDbType.VarChar,250),
					new SqlParameter("@jingbao", SqlDbType.VarChar,250),
					new SqlParameter("@tux", SqlDbType.VarChar,250),
					new SqlParameter("@value0", SqlDbType.Int,4),
					new SqlParameter("@rate0", SqlDbType.Int,4),
					new SqlParameter("@value1", SqlDbType.Int,4),
					new SqlParameter("@rate1", SqlDbType.Int,4),
					new SqlParameter("@value2", SqlDbType.Int,4),
					new SqlParameter("@rate2", SqlDbType.Int,4),
					new SqlParameter("@value3", SqlDbType.Int,4),
					new SqlParameter("@rate3", SqlDbType.Int,4),
					new SqlParameter("@value4", SqlDbType.Int,4),
					new SqlParameter("@rate4", SqlDbType.Int,4),
					new SqlParameter("@value5", SqlDbType.Int,4),
					new SqlParameter("@rate5", SqlDbType.Int,4),
					new SqlParameter("@user_index", SqlDbType.Int,4),
					new SqlParameter("@name", SqlDbType.VarChar,50),
					new SqlParameter("@mobile", SqlDbType.VarChar,50)};
            parameters[0].Value = model.index;
            parameters[1].Value = model.mac;
            parameters[2].Value = model.simno;
            parameters[3].Value = model.addr;
            parameters[4].Value = model.msgno;
            parameters[5].Value = model.areano;
            parameters[6].Value = model.adminno;
            parameters[7].Value = model.intvalue1;
            parameters[8].Value = model.intvalue2;
            parameters[9].Value = model.intvalue3;
            parameters[10].Value = model.charvalue1;
            parameters[11].Value = model.charvalue2;
            parameters[12].Value = model.charvalue3;
            parameters[13].Value = model.wendu;
            parameters[14].Value = model.dianchi;
            parameters[15].Value = model.gongdian;
            parameters[16].Value = model.dianliang;
            parameters[17].Value = model.chuanganqi;
            parameters[18].Value = model.jingbao;
            parameters[19].Value = model.tux;
            parameters[20].Value = model.value0;
            parameters[21].Value = model.rate0;
            parameters[22].Value = model.value1;
            parameters[23].Value = model.rate1;
            parameters[24].Value = model.value2;
            parameters[25].Value = model.rate2;
            parameters[26].Value = model.value3;
            parameters[27].Value = model.rate3;
            parameters[28].Value = model.value4;
            parameters[29].Value = model.rate4;
            parameters[30].Value = model.value5;
            parameters[31].Value = model.rate5;
            parameters[32].Value = model.user_index;
            parameters[33].Value = model.name;
            parameters[34].Value = model.mobile;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(HYSoft.Model.usr2node model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update usr2node set ");
            strSql.Append("[index]=@index,");
            strSql.Append("mac=@mac,");
            strSql.Append("simno=@simno,");
            strSql.Append("addr=@addr,");
            strSql.Append("msgno=@msgno,");
            strSql.Append("areano=@areano,");
            strSql.Append("adminno=@adminno,");
            strSql.Append("intvalue1=@intvalue1,");
            strSql.Append("intvalue2=@intvalue2,");
            strSql.Append("intvalue3=@intvalue3,");
            strSql.Append("charvalue1=@charvalue1,");
            strSql.Append("charvalue2=@charvalue2,");
            strSql.Append("charvalue3=@charvalue3,");
            strSql.Append("wendu=@wendu,");
            strSql.Append("dianchi=@dianchi,");
            strSql.Append("gongdian=@gongdian,");
            strSql.Append("dianliang=@dianliang,");
            strSql.Append("chuanganqi=@chuanganqi,");
            strSql.Append("jingbao=@jingbao,");
            strSql.Append("tux=@tux,");
            strSql.Append("value0=@value0,");
            strSql.Append("rate0=@rate0,");
            strSql.Append("value1=@value1,");
            strSql.Append("rate1=@rate1,");
            strSql.Append("value2=@value2,");
            strSql.Append("rate2=@rate2,");
            strSql.Append("value3=@value3,");
            strSql.Append("rate3=@rate3,");
            strSql.Append("value4=@value4,");
            strSql.Append("rate4=@rate4,");
            strSql.Append("value5=@value5,");
            strSql.Append("rate5=@rate5,");
            strSql.Append("user_index=@user_index,");
            strSql.Append("name=@name,");
            strSql.Append("mobile=@mobile");
            strSql.Append(" where [index]=@index and mac=@mac and simno=@simno and addr=@addr and msgno=@msgno and areano=@areano and adminno=@adminno and intvalue1=@intvalue1 and intvalue2=@intvalue2 and intvalue3=@intvalue3 and charvalue1=@charvalue1 and charvalue2=@charvalue2 and charvalue3=@charvalue3 and wendu=@wendu and dianchi=@dianchi and gongdian=@gongdian and dianliang=@dianliang and chuanganqi=@chuanganqi and jingbao=@jingbao and tux=@tux and value0=@value0 and rate0=@rate0 and value1=@value1 and rate1=@rate1 and value2=@value2 and rate2=@rate2 and value3=@value3 and rate3=@rate3 and value4=@value4 and rate4=@rate4 and value5=@value5 and rate5=@rate5 and user_index=@user_index and name=@name and mobile=@mobile ");
            SqlParameter[] parameters = {
					new SqlParameter("@index", SqlDbType.Int,4),
					new SqlParameter("@mac", SqlDbType.Int,4),
					new SqlParameter("@simno", SqlDbType.VarChar,50),
					new SqlParameter("@addr", SqlDbType.VarChar,250),
					new SqlParameter("@msgno", SqlDbType.VarChar,50),
					new SqlParameter("@areano", SqlDbType.Int,4),
					new SqlParameter("@adminno", SqlDbType.Int,4),
					new SqlParameter("@intvalue1", SqlDbType.Int,4),
					new SqlParameter("@intvalue2", SqlDbType.Int,4),
					new SqlParameter("@intvalue3", SqlDbType.Int,4),
					new SqlParameter("@charvalue1", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue2", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue3", SqlDbType.VarChar,250),
					new SqlParameter("@wendu", SqlDbType.VarChar,250),
					new SqlParameter("@dianchi", SqlDbType.VarChar,250),
					new SqlParameter("@gongdian", SqlDbType.VarChar,250),
					new SqlParameter("@dianliang", SqlDbType.VarChar,250),
					new SqlParameter("@chuanganqi", SqlDbType.VarChar,250),
					new SqlParameter("@jingbao", SqlDbType.VarChar,250),
					new SqlParameter("@tux", SqlDbType.VarChar,250),
					new SqlParameter("@value0", SqlDbType.Int,4),
					new SqlParameter("@rate0", SqlDbType.Int,4),
					new SqlParameter("@value1", SqlDbType.Int,4),
					new SqlParameter("@rate1", SqlDbType.Int,4),
					new SqlParameter("@value2", SqlDbType.Int,4),
					new SqlParameter("@rate2", SqlDbType.Int,4),
					new SqlParameter("@value3", SqlDbType.Int,4),
					new SqlParameter("@rate3", SqlDbType.Int,4),
					new SqlParameter("@value4", SqlDbType.Int,4),
					new SqlParameter("@rate4", SqlDbType.Int,4),
					new SqlParameter("@value5", SqlDbType.Int,4),
					new SqlParameter("@rate5", SqlDbType.Int,4),
					new SqlParameter("@user_index", SqlDbType.Int,4),
					new SqlParameter("@name", SqlDbType.VarChar,50),
					new SqlParameter("@mobile", SqlDbType.VarChar,50)};
            parameters[0].Value = model.index;
            parameters[1].Value = model.mac;
            parameters[2].Value = model.simno;
            parameters[3].Value = model.addr;
            parameters[4].Value = model.msgno;
            parameters[5].Value = model.areano;
            parameters[6].Value = model.adminno;
            parameters[7].Value = model.intvalue1;
            parameters[8].Value = model.intvalue2;
            parameters[9].Value = model.intvalue3;
            parameters[10].Value = model.charvalue1;
            parameters[11].Value = model.charvalue2;
            parameters[12].Value = model.charvalue3;
            parameters[13].Value = model.wendu;
            parameters[14].Value = model.dianchi;
            parameters[15].Value = model.gongdian;
            parameters[16].Value = model.dianliang;
            parameters[17].Value = model.chuanganqi;
            parameters[18].Value = model.jingbao;
            parameters[19].Value = model.tux;
            parameters[20].Value = model.value0;
            parameters[21].Value = model.rate0;
            parameters[22].Value = model.value1;
            parameters[23].Value = model.rate1;
            parameters[24].Value = model.value2;
            parameters[25].Value = model.rate2;
            parameters[26].Value = model.value3;
            parameters[27].Value = model.rate3;
            parameters[28].Value = model.value4;
            parameters[29].Value = model.rate4;
            parameters[30].Value = model.value5;
            parameters[31].Value = model.rate5;
            parameters[32].Value = model.user_index;
            parameters[33].Value = model.name;
            parameters[34].Value = model.mobile;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int index, int mac, string simno, string addr, string msgno, int areano, int adminno, int intvalue1, int intvalue2, int intvalue3, string charvalue1, string charvalue2, string charvalue3, string wendu, string dianchi, string gongdian, string dianliang, string chuanganqi, string jingbao, string tux, int value0, int rate0, int value1, int rate1, int value2, int rate2, int value3, int rate3, int value4, int rate4, int value5, int rate5, int user_index, string name, string mobile)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from usr2node ");
            strSql.Append(" where [index]=@index and mac=@mac and simno=@simno and addr=@addr and msgno=@msgno and areano=@areano and adminno=@adminno and intvalue1=@intvalue1 and intvalue2=@intvalue2 and intvalue3=@intvalue3 and charvalue1=@charvalue1 and charvalue2=@charvalue2 and charvalue3=@charvalue3 and wendu=@wendu and dianchi=@dianchi and gongdian=@gongdian and dianliang=@dianliang and chuanganqi=@chuanganqi and jingbao=@jingbao and tux=@tux and value0=@value0 and rate0=@rate0 and value1=@value1 and rate1=@rate1 and value2=@value2 and rate2=@rate2 and value3=@value3 and rate3=@rate3 and value4=@value4 and rate4=@rate4 and value5=@value5 and rate5=@rate5 and user_index=@user_index and name=@name and mobile=@mobile ");
            SqlParameter[] parameters = {
					new SqlParameter("@index", SqlDbType.Int,4),
					new SqlParameter("@mac", SqlDbType.Int,4),
					new SqlParameter("@simno", SqlDbType.VarChar,50),
					new SqlParameter("@addr", SqlDbType.VarChar,250),
					new SqlParameter("@msgno", SqlDbType.VarChar,50),
					new SqlParameter("@areano", SqlDbType.Int,4),
					new SqlParameter("@adminno", SqlDbType.Int,4),
					new SqlParameter("@intvalue1", SqlDbType.Int,4),
					new SqlParameter("@intvalue2", SqlDbType.Int,4),
					new SqlParameter("@intvalue3", SqlDbType.Int,4),
					new SqlParameter("@charvalue1", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue2", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue3", SqlDbType.VarChar,250),
					new SqlParameter("@wendu", SqlDbType.VarChar,250),
					new SqlParameter("@dianchi", SqlDbType.VarChar,250),
					new SqlParameter("@gongdian", SqlDbType.VarChar,250),
					new SqlParameter("@dianliang", SqlDbType.VarChar,250),
					new SqlParameter("@chuanganqi", SqlDbType.VarChar,250),
					new SqlParameter("@jingbao", SqlDbType.VarChar,250),
					new SqlParameter("@tux", SqlDbType.VarChar,250),
					new SqlParameter("@value0", SqlDbType.Int,4),
					new SqlParameter("@rate0", SqlDbType.Int,4),
					new SqlParameter("@value1", SqlDbType.Int,4),
					new SqlParameter("@rate1", SqlDbType.Int,4),
					new SqlParameter("@value2", SqlDbType.Int,4),
					new SqlParameter("@rate2", SqlDbType.Int,4),
					new SqlParameter("@value3", SqlDbType.Int,4),
					new SqlParameter("@rate3", SqlDbType.Int,4),
					new SqlParameter("@value4", SqlDbType.Int,4),
					new SqlParameter("@rate4", SqlDbType.Int,4),
					new SqlParameter("@value5", SqlDbType.Int,4),
					new SqlParameter("@rate5", SqlDbType.Int,4),
					new SqlParameter("@user_index", SqlDbType.Int,4),
					new SqlParameter("@name", SqlDbType.VarChar,50),
					new SqlParameter("@mobile", SqlDbType.VarChar,50)			};
            parameters[0].Value = index;
            parameters[1].Value = mac;
            parameters[2].Value = simno;
            parameters[3].Value = addr;
            parameters[4].Value = msgno;
            parameters[5].Value = areano;
            parameters[6].Value = adminno;
            parameters[7].Value = intvalue1;
            parameters[8].Value = intvalue2;
            parameters[9].Value = intvalue3;
            parameters[10].Value = charvalue1;
            parameters[11].Value = charvalue2;
            parameters[12].Value = charvalue3;
            parameters[13].Value = wendu;
            parameters[14].Value = dianchi;
            parameters[15].Value = gongdian;
            parameters[16].Value = dianliang;
            parameters[17].Value = chuanganqi;
            parameters[18].Value = jingbao;
            parameters[19].Value = tux;
            parameters[20].Value = value0;
            parameters[21].Value = rate0;
            parameters[22].Value = value1;
            parameters[23].Value = rate1;
            parameters[24].Value = value2;
            parameters[25].Value = rate2;
            parameters[26].Value = value3;
            parameters[27].Value = rate3;
            parameters[28].Value = value4;
            parameters[29].Value = rate4;
            parameters[30].Value = value5;
            parameters[31].Value = rate5;
            parameters[32].Value = user_index;
            parameters[33].Value = name;
            parameters[34].Value = mobile;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HYSoft.Model.usr2node GetModel(int index, int mac, string simno, string addr, string msgno, int areano, int adminno, int intvalue1, int intvalue2, int intvalue3, string charvalue1, string charvalue2, string charvalue3, string wendu, string dianchi, string gongdian, string dianliang, string chuanganqi, string jingbao, string tux, int value0, int rate0, int value1, int rate1, int value2, int rate2, int value3, int rate3, int value4, int rate4, int value5, int rate5, int user_index, string name, string mobile)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 [index],mac,simno,addr,msgno,areano,adminno,intvalue1,intvalue2,intvalue3,charvalue1,charvalue2,charvalue3,wendu,dianchi,gongdian,dianliang,chuanganqi,jingbao,tux,value0,rate0,value1,rate1,value2,rate2,value3,rate3,value4,rate4,value5,rate5,user_index,name,mobile from usr2node ");
            strSql.Append(" where [index]=@index and mac=@mac and simno=@simno and addr=@addr and msgno=@msgno and areano=@areano and adminno=@adminno and intvalue1=@intvalue1 and intvalue2=@intvalue2 and intvalue3=@intvalue3 and charvalue1=@charvalue1 and charvalue2=@charvalue2 and charvalue3=@charvalue3 and wendu=@wendu and dianchi=@dianchi and gongdian=@gongdian and dianliang=@dianliang and chuanganqi=@chuanganqi and jingbao=@jingbao and tux=@tux and value0=@value0 and rate0=@rate0 and value1=@value1 and rate1=@rate1 and value2=@value2 and rate2=@rate2 and value3=@value3 and rate3=@rate3 and value4=@value4 and rate4=@rate4 and value5=@value5 and rate5=@rate5 and user_index=@user_index and name=@name and mobile=@mobile ");
            SqlParameter[] parameters = {
					new SqlParameter("@index", SqlDbType.Int,4),
					new SqlParameter("@mac", SqlDbType.Int,4),
					new SqlParameter("@simno", SqlDbType.VarChar,50),
					new SqlParameter("@addr", SqlDbType.VarChar,250),
					new SqlParameter("@msgno", SqlDbType.VarChar,50),
					new SqlParameter("@areano", SqlDbType.Int,4),
					new SqlParameter("@adminno", SqlDbType.Int,4),
					new SqlParameter("@intvalue1", SqlDbType.Int,4),
					new SqlParameter("@intvalue2", SqlDbType.Int,4),
					new SqlParameter("@intvalue3", SqlDbType.Int,4),
					new SqlParameter("@charvalue1", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue2", SqlDbType.VarChar,250),
					new SqlParameter("@charvalue3", SqlDbType.VarChar,250),
					new SqlParameter("@wendu", SqlDbType.VarChar,250),
					new SqlParameter("@dianchi", SqlDbType.VarChar,250),
					new SqlParameter("@gongdian", SqlDbType.VarChar,250),
					new SqlParameter("@dianliang", SqlDbType.VarChar,250),
					new SqlParameter("@chuanganqi", SqlDbType.VarChar,250),
					new SqlParameter("@jingbao", SqlDbType.VarChar,250),
					new SqlParameter("@tux", SqlDbType.VarChar,250),
					new SqlParameter("@value0", SqlDbType.Int,4),
					new SqlParameter("@rate0", SqlDbType.Int,4),
					new SqlParameter("@value1", SqlDbType.Int,4),
					new SqlParameter("@rate1", SqlDbType.Int,4),
					new SqlParameter("@value2", SqlDbType.Int,4),
					new SqlParameter("@rate2", SqlDbType.Int,4),
					new SqlParameter("@value3", SqlDbType.Int,4),
					new SqlParameter("@rate3", SqlDbType.Int,4),
					new SqlParameter("@value4", SqlDbType.Int,4),
					new SqlParameter("@rate4", SqlDbType.Int,4),
					new SqlParameter("@value5", SqlDbType.Int,4),
					new SqlParameter("@rate5", SqlDbType.Int,4),
					new SqlParameter("@user_index", SqlDbType.Int,4),
					new SqlParameter("@name", SqlDbType.VarChar,50),
					new SqlParameter("@mobile", SqlDbType.VarChar,50)			};
            parameters[0].Value = index;
            parameters[1].Value = mac;
            parameters[2].Value = simno;
            parameters[3].Value = addr;
            parameters[4].Value = msgno;
            parameters[5].Value = areano;
            parameters[6].Value = adminno;
            parameters[7].Value = intvalue1;
            parameters[8].Value = intvalue2;
            parameters[9].Value = intvalue3;
            parameters[10].Value = charvalue1;
            parameters[11].Value = charvalue2;
            parameters[12].Value = charvalue3;
            parameters[13].Value = wendu;
            parameters[14].Value = dianchi;
            parameters[15].Value = gongdian;
            parameters[16].Value = dianliang;
            parameters[17].Value = chuanganqi;
            parameters[18].Value = jingbao;
            parameters[19].Value = tux;
            parameters[20].Value = value0;
            parameters[21].Value = rate0;
            parameters[22].Value = value1;
            parameters[23].Value = rate1;
            parameters[24].Value = value2;
            parameters[25].Value = rate2;
            parameters[26].Value = value3;
            parameters[27].Value = rate3;
            parameters[28].Value = value4;
            parameters[29].Value = rate4;
            parameters[30].Value = value5;
            parameters[31].Value = rate5;
            parameters[32].Value = user_index;
            parameters[33].Value = name;
            parameters[34].Value = mobile;

            HYSoft.Model.usr2node model = new HYSoft.Model.usr2node();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HYSoft.Model.usr2node DataRowToModel(DataRow row)
        {
            HYSoft.Model.usr2node model = new HYSoft.Model.usr2node();
            if (row != null)
            {
                if (row["index"] != null && row["index"].ToString() != "")
                {
                    model.index = int.Parse(row["index"].ToString());
                }
                if (row["mac"] != null && row["mac"].ToString() != "")
                {
                    model.mac = int.Parse(row["mac"].ToString());
                }
                if (row["simno"] != null)
                {
                    model.simno = row["simno"].ToString();
                }
                if (row["addr"] != null)
                {
                    model.addr = row["addr"].ToString();
                }
                if (row["msgno"] != null)
                {
                    model.msgno = row["msgno"].ToString();
                }
                if (row["areano"] != null && row["areano"].ToString() != "")
                {
                    model.areano = int.Parse(row["areano"].ToString());
                }
                if (row["adminno"] != null && row["adminno"].ToString() != "")
                {
                    model.adminno = int.Parse(row["adminno"].ToString());
                }
                if (row["intvalue1"] != null && row["intvalue1"].ToString() != "")
                {
                    model.intvalue1 = int.Parse(row["intvalue1"].ToString());
                }
                if (row["intvalue2"] != null && row["intvalue2"].ToString() != "")
                {
                    model.intvalue2 = int.Parse(row["intvalue2"].ToString());
                }
                if (row["intvalue3"] != null && row["intvalue3"].ToString() != "")
                {
                    model.intvalue3 = int.Parse(row["intvalue3"].ToString());
                }
                if (row["charvalue1"] != null)
                {
                    model.charvalue1 = row["charvalue1"].ToString();
                }
                if (row["charvalue2"] != null)
                {
                    model.charvalue2 = row["charvalue2"].ToString();
                }
                if (row["charvalue3"] != null)
                {
                    model.charvalue3 = row["charvalue3"].ToString();
                }
                if (row["wendu"] != null)
                {
                    model.wendu = row["wendu"].ToString();
                }
                if (row["dianchi"] != null)
                {
                    model.dianchi = row["dianchi"].ToString();
                }
                if (row["gongdian"] != null)
                {
                    model.gongdian = row["gongdian"].ToString();
                }
                if (row["dianliang"] != null)
                {
                    model.dianliang = row["dianliang"].ToString();
                }
                if (row["chuanganqi"] != null)
                {
                    model.chuanganqi = row["chuanganqi"].ToString();
                }
                if (row["jingbao"] != null)
                {
                    model.jingbao = row["jingbao"].ToString();
                }
                if (row["tux"] != null)
                {
                    model.tux = row["tux"].ToString();
                }
                if (row["value0"] != null && row["value0"].ToString() != "")
                {
                    model.value0 = int.Parse(row["value0"].ToString());
                }
                if (row["rate0"] != null && row["rate0"].ToString() != "")
                {
                    model.rate0 = int.Parse(row["rate0"].ToString());
                }
                if (row["value1"] != null && row["value1"].ToString() != "")
                {
                    model.value1 = int.Parse(row["value1"].ToString());
                }
                if (row["rate1"] != null && row["rate1"].ToString() != "")
                {
                    model.rate1 = int.Parse(row["rate1"].ToString());
                }
                if (row["value2"] != null && row["value2"].ToString() != "")
                {
                    model.value2 = int.Parse(row["value2"].ToString());
                }
                if (row["rate2"] != null && row["rate2"].ToString() != "")
                {
                    model.rate2 = int.Parse(row["rate2"].ToString());
                }
                if (row["value3"] != null && row["value3"].ToString() != "")
                {
                    model.value3 = int.Parse(row["value3"].ToString());
                }
                if (row["rate3"] != null && row["rate3"].ToString() != "")
                {
                    model.rate3 = int.Parse(row["rate3"].ToString());
                }
                if (row["value4"] != null && row["value4"].ToString() != "")
                {
                    model.value4 = int.Parse(row["value4"].ToString());
                }
                if (row["rate4"] != null && row["rate4"].ToString() != "")
                {
                    model.rate4 = int.Parse(row["rate4"].ToString());
                }
                if (row["value5"] != null && row["value5"].ToString() != "")
                {
                    model.value5 = int.Parse(row["value5"].ToString());
                }
                if (row["rate5"] != null && row["rate5"].ToString() != "")
                {
                    model.rate5 = int.Parse(row["rate5"].ToString());
                }
                if (row["user_index"] != null && row["user_index"].ToString() != "")
                {
                    model.user_index = int.Parse(row["user_index"].ToString());
                }
                if (row["name"] != null)
                {
                    model.name = row["name"].ToString();
                }
                if (row["mobile"] != null)
                {
                    model.mobile = row["mobile"].ToString();
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select [index],mac,simno,addr,msgno,areano,adminno,intvalue1,intvalue2,intvalue3,charvalue1,charvalue2,charvalue3,wendu,dianchi,gongdian,dianliang,chuanganqi,jingbao,tux,value0,rate0,value1,rate1,value2,rate2,value3,rate3,value4,rate4,value5,rate5,user_index,name,mobile ");
            strSql.Append(" FROM usr2node ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" [index],mac,simno,addr,msgno,areano,adminno,intvalue1,intvalue2,intvalue3,charvalue1,charvalue2,charvalue3,wendu,dianchi,gongdian,dianliang,chuanganqi,jingbao,tux,value0,rate0,value1,rate1,value2,rate2,value3,rate3,value4,rate4,value5,rate5,user_index,name,mobile ");
            strSql.Append(" FROM usr2node ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM usr2node ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.mobile desc");
            }
            strSql.Append(")AS Row, T.*  from usr2node T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "usr2node";
            parameters[1].Value = "mobile";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}